<?php
class Control_ImgCode extends QUI_Control_Abstract
{
    function render()
    {
        //$udi     = $this->get('udi', 'default/imgcode');
        $id      = h($this->id());
        
        $url     = h(url('default::default/imgcode'));
        $out = "<input type=\"text\" ";
        $out .= $this->_printIdAndName();
        $out .= $this->_printAttrs('id, name');
				$out .= $this->_printDisabled();
        $out .= " />\n";
				$out .= <<<EOT
<script>
$(function(){
	$('#{$id}_img').click(function(){
	this.src = '{$url}/rand/' + Math.random();
});
})

</script>
<span id="{$id}_span">
<img id="{$id}_img" src="{$url}" border="0" style="cursor: pointer;" title="点击更换图像" />
</span>
EOT;
        return $out;
    }
}